home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / MacTechNotes / Platforms & Tools / Stand-Alone Code Folder / SAGlobalsƒ / SAGlobals.p < prev   
Encoding:
Text File  |  1990-07-15  |  2.2 KB  |  62 lines  |  [TEXT/MPS ]

  1.  
  2. { Stand-alone code modules which need to use global variables
  3.   may include the interfaces in this unit. Such code modules
  4.   must also be linked with Runtime.o and SAGlobals.o. }
  5.  
  6. UNIT SAGlobals;
  7.  
  8. INTERFACE
  9.  
  10.     USES
  11.         Types, Memory, OSUtils;
  12.     
  13.     TYPE
  14.         A5RefType = Handle;
  15.  
  16.     { MakeA5World allocates space for an A5 world based on the
  17.       size of the global variables defined by the module and its
  18.       units. If sufficient space is not available, MakeA5World
  19.       returns NIL for A5Ref and further initialization is aborted. }
  20.     PROCEDURE MakeA5World (VAR A5Ref: A5RefType);
  21.  
  22.     { SetA5World locks down a previously-allocated handle containing
  23.       an A5 world and sets the A5 register appropriately. The return
  24.       value is the old value of A5 and the client should save it for
  25.       use by RestoreA5World. }
  26.     FUNCTION SetA5World (A5Ref: A5RefType) : Longint;
  27.  
  28.     { RestoreA5World restores A5 to its original value (which the
  29.       client should have saved) and unlocks the A5 world to avoid
  30.       heap fragmentation in cases where the world is used again. }
  31.     PROCEDURE RestoreA5World (oldA5: Longint; A5Ref: A5RefType);
  32.  
  33.     { DisposeA5World simply disposes of the A5 world handle. }
  34.     PROCEDURE DisposeA5World (A5Ref: A5RefType);
  35.  
  36.     { OpenA5World combines MakeA5World and SetA5World for the majority
  37.       of cases in which these two routines are called consecutively. An
  38.       exception is when a single A5 world is invoked many times. In this
  39.       case, the world is only created once with MakeA5World and it is
  40.       invoked each time by SetA5World. Most developers will find it easier
  41.       just to call OpenA5World and CloseA5World at the end. If the memory
  42.       allocation request fails, OpenA5World returns NIL for A5Ref and zero
  43.       in the function result. }
  44.     FUNCTION OpenA5World (VAR A5Ref: A5RefType) : Longint;
  45.  
  46.     { CloseA5World is the dual of OpenA5World. It combines RestoreA5World
  47.       and DisposeA5World. Again, in certain cases it may be necessary to
  48.       call those two routines explicitly, but most of the time CloseA5World
  49.       is all that is required. }
  50.     PROCEDURE CloseA5World (oldA5: Longint; A5Ref: A5RefType);
  51.  
  52.  
  53.     {$IFC UNDEFINED BuildLib}
  54.         {$SETC BuildLib := 0}
  55.     {$ENDC}
  56.     
  57.     {$IFC BuildLib}
  58.         {$I SAGlobals.inc1.p}
  59.     {$ENDC}
  60.     
  61. END.
  62.